package com.ruoyi.common.nmzp.server.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.common.nmzp.server.entity.domain.NmzpMessage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author xiaoxin
* @description 针对表【nmzp_message】的数据库操作Mapper
* @createDate 2024-11-05 11:21:35
* @Entity com.xiaoxin.nmzp.server.entity.domain.NmzpMessage
*/
@Mapper
public interface NmzpMessageMapper extends BaseMapper<NmzpMessage> {

    @Select("SELECT \n" +
            "    *\n" +
            "FROM \n" +
            "    nmzp_message\n" +
            "WHERE \n" +
            "    (sender_id = #{userId} and recipient_id = #{targetId}) or \n" +
            "    (sender_id = #{targetId} and recipient_id = #{userId})\n" +
            "ORDER BY \n" +
            "    create_time asc")
    public List<NmzpMessage> getTargetMsg(@Param("userId") Long userId,@Param("targetId") Long targetId);


}




